export function shuffle (songs) {
  const res = songs.slice(0)
  for (let i = 0; i < songs.length; i++) {
    const swapIndex = Math.floor((Math.random() * songs.length))
    ;[res[swapIndex], res[i]] = [res[i], res[swapIndex]]
  }
  //   console.log(res)
  return res
}

// 格式化时间
export function formatTime (time) {
  time = Math.floor(time)
  // padStart不足两位前面填充0
  const min = (Math.floor(time / 60) + '').padStart(2, '0')
  const sec = (Math.floor(time % 60) + '').padStart(2, '0')
  return `${min}:${sec}`
}
